<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>Luat开源项目脚本lib</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>script_LuaTask lib</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>


<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/aLiYun.html">aLiYun</a></li>
  <li><a href="../modules/aLiYunOta.html">aLiYunOta</a></li>
  <li><a href="../modules/agps.html">agps</a></li>
  <li><a href="../modules/agpsHxxt.html">agpsHxxt</a></li>
  <li><a href="../modules/agpsZkw.html">agpsZkw</a></li>
  <li><a href="../modules/audio.html">audio</a></li>
  <li><a href="../modules/cc.html">cc</a></li>
  <li><a href="../modules/clib.html">clib</a></li>
  <li><a href="../modules/common.html">common</a></li>
  <li><a href="../modules/console.html">console</a></li>
  <li><a href="../modules/errDump.html">errDump</a></li>
  <li><a href="../modules/ftp.html">ftp</a></li>
  <li><a href="../modules/gps.html">gps</a></li>
  <li><a href="../modules/gpsHxxt.html">gpsHxxt</a></li>
  <li><a href="../modules/gpsZkw.html">gpsZkw</a></li>
  <li><a href="../modules/http.html">http</a></li>
  <li><a href="../modules/lbsLoc.html">lbsLoc</a></li>
  <li><a href="../modules/led.html">led</a></li>
  <li><a href="../modules/link.html">link</a></li>
  <li><a href="../modules/log.html">log</a></li>
  <li><a href="../modules/misc.html">misc</a></li>
  <li><a href="../modules/mqtt.html">mqtt</a></li>
  <li><a href="../modules/net.html">net</a></li>
  <li><a href="../modules/netLed.html">netLed</a></li>
  <li><a href="../modules/ntp.html">ntp</a></li>
  <li><a href="../modules/nvm.html">nvm</a></li>
  <li><a href="../modules/patch.html">patch</a></li>
  <li><a href="../modules/pb.html">pb</a></li>
  <li><a href="../modules/pins.html">pins</a></li>
  <li><a href="../modules/pm.html">pm</a></li>
  <li><a href="../modules/powerKey.html">powerKey</a></li>
  <li><a href="../modules/record.html">record</a></li>
  <li><a href="../modules/ril.html">ril</a></li>
  <li><a href="../modules/scanCode.html">scanCode</a></li>
  <li><strong>sim</strong></li>
  <li><a href="../modules/sms.html">sms</a></li>
  <li><a href="../modules/socket.html">socket</a></li>
  <li><a href="../modules/sys.html">sys</a></li>
  <li><a href="../modules/uiWin.html">uiWin</a></li>
  <li><a href="../modules/update.html">update</a></li>
  <li><a href="../modules/utils.html">utils</a></li>
  <li><a href="../modules/websocket.html">websocket</a></li>
  <li><a href="../modules/wifiScan.html">wifiScan</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>sim</code></h1>
<p>模块功能：查询sim卡状态、iccid、imsi、mcc、mnc</p>
<p></p>
    <h3>Info:</h3>
    <ul>
        <li><strong>Copyright</strong>: openLuat</li>
        <li><strong>Release</strong>: 2017.02.13</li>
        <li><strong>License</strong>: MIT</li>
        <li><strong>Author</strong>: openLuat</li>
    </ul>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#getIccid">
    getIccid ()
    </a></td>
	<td class="summary">获取sim卡的iccid</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getImsi">
    getImsi ()
    </a></td>
	<td class="summary">获取sim卡的imsi</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getMcc">
    getMcc ()
    </a></td>
	<td class="summary">获取sim卡的mcc</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getMnc">
    getMnc ()
    </a></td>
	<td class="summary">获取sim卡的getmnc</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getStatus">
    getStatus ()
    </a></td>
	<td class="summary">获取sim卡的状态</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#setQueryNumber">
    setQueryNumber (flag)
    </a></td>
	<td class="summary">设置“是否打开查询本机号码”的功能</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getNumber">
    getNumber ()
    </a></td>
	<td class="summary">获取sim卡的本机号码</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#setId">
    setId (id<strong  style="color: gray;">[, cbFnc=nil]</strong>)
    </a></td>
	<td class="summary">设置双卡单待sim id</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getId">
    getId ()
    </a></td>
	<td class="summary">获取目前设置的双卡单待id</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "getIccid"></a>
    <strong  style="color: red;">
    getIccid ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的iccid</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">string ,返回iccid，如果还没有读取出来，则返回nil</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">注意：开机lua脚本运行之后，会发送at命令去查询iccid，所以需要一定时间才能获取到iccid。开机后立即调用此接口，基本上返回<span class="keyword">nil</span></pre></il>
        <li><pre class="example">sim.getIccid()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getImsi"></a>
    <strong  style="color: red;">
    getImsi ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的imsi</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">string ,返回imsi，如果还没有读取出来，则返回nil</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">开机lua脚本运行之后，会发送at命令去查询imsi，所以需要一定时间才能获取到imsi。开机后立即调用此接口，基本上返回<span class="keyword">nil</span></pre></il>
        <li><pre class="example">sim.getImsi()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getMcc"></a>
    <strong  style="color: red;">
    getMcc ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的mcc</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">string ,返回值：mcc，如果还没有读取出来，则返回""</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">注意：开机lua脚本运行之后，会发送at命令去查询imsi，所以需要一定时间才能获取到imsi。开机后立即调用此接口，基本上返回<span class="string">""</span></pre></il>
        <li><pre class="example">sim.getMcc()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getMnc"></a>
    <strong  style="color: red;">
    getMnc ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的getmnc</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">string ,返回mnc，如果还没有读取出来，则返回""</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">注意：开机lua脚本运行之后，会发送at命令去查询imsi，所以需要一定时间才能获取到imsi。开机后立即调用此接口，基本上返回<span class="string">""</span></pre></il>
        <li><pre class="example">sim.getMnc()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getStatus"></a>
    <strong  style="color: red;">
    getStatus ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的状态</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">bool ,true表示sim卡正常，false或者nil表示未检测到卡或者卡异常</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">开机lua脚本运行之后，会发送at命令去查询状态，所以需要一定时间才能获取到状态。开机后立即调用此接口，基本上返回<span class="keyword">nil</span></pre></il>
        <li><pre class="example">sim.getStatus()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "setQueryNumber"></a>
    <strong  style="color: red;">
    setQueryNumber (flag)
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">设置“是否打开查询本机号码”的功能</pre>


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">flag</span>
            <span class="types"><span class="type">bool</span></span>
        <pre class="example">开启或者关闭查询功能的标志，false或者nil为关闭，其余为开启</pre>
        </li>
    </ul>

    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">nil</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">sim.setQueryNumber(<span class="keyword">true</span>)</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getNumber"></a>
    <strong  style="color: red;">
    getNumber ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取sim卡的本机号码</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">string ,返回值：sNumber，如果还没有读取出来或者读取失败，则返回""</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">注意：开机lua脚本运行之后，会发送at命令去查询本机号码，所以需要一定时间才能获取到本机号码。开机后立即调用此接口，基本上返回<span class="string">""</span></pre></il>
        <li><pre class="example">注意：此功能需要卡商支持，卡商必须把卡写到sim卡中，模块才能从卡中读出号码；目前市场上的很多卡，没有写入号码，是无法读取得</pre></il>
        <li><pre class="example">sim.getNumber()</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "setId"></a>
    <strong  style="color: red;">
    setId (id<strong  style="color: green;">[, cbFnc=nil]</strong>)
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">设置双卡单待sim id</pre>


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">id</span>
            <span class="types"><span class="type">number</span></span>
        <pre class="example">双卡单待的sim id，仅支持0和1</pre>
        </li>
        <li><span class="parameter">cbFnc</span>
            <span class="types"><span class="type">function</span></span>
         [<em>此参数可选，默认值为：</em> nil]
        <pre class="example">设置结果回调函数，回调函数的调用形式为：
 cnFnc(result)，result为true表示成功，false或者nil为失败</pre>
        </li>
    </ul>

    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">nil</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">sim.setId(<span class="number">0</span>)
sim.setId(<span class="number">1</span>,cbFnc)</pre></il>
    </ul>

</dd>
    <dt>
    <a name = "getId"></a>
    <strong  style="color: red;">
    getId ()
    </strong>
    </dt>
    <dd>
    <pre class="example"  style="color: red;">获取目前设置的双卡单待id</pre>



    <h3>Returns:</h3>
    <ul>
        <li>
        <pre class="example">number ,返回id(0或者1)，如果还没有读取出来，则返回nil</pre></il>
    </ul>



    <h3>Usage:</h3>
    <ul>
        <li><pre class="example">注意：开机lua脚本运行之后，会发送at命令去查询id，所以需要一定时间才能获取到id。开机后立即调用此接口，基本上返回<span class="keyword">nil</span></pre></il>
        <li><pre class="example">sim.getId()</pre></il>
    </ul>

</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-08-02 13:53:19 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

